Check input file for unicode format.
authoroliskoli <oliskoli>
Thu, 4 Sep 2008 21:29:22 +0000 (21:29 +0000)
committeroliskoli <oliskoli>
Thu, 4 Sep 2008 21:29:22 +0000 (21:29 +0000)
19 files changed:
arcdist.c
compegps.c
cst.c
g7towin.c
gopal.c
gpsutil.c
igc.c
main.c
netstumbler.c
nmea.c
nmn4.c
overlay.c
ozi.c
pcx.c
polygon.c
stmsdf.c
stmwpp.c
tiger.c
tmpro.c

index ecbc75db2ebe4625dd388eaeaea61e9354a37586..3b9a8764060da24300b586d916b1481648b3d594 100644 (file)
--- a/arcdist.c
+++ b/arcdist.c
@@ -63,6 +63,7 @@ arcdist_process(void)
        gbfile *file_in;
 
        file_in = gbfopen(arcfileopt, "r", MYNAME);
+       (void) gbfunicode(file_in);     /* check for unicode text file */
        
         lat1 = lon1 = lat2 = lon2 = BADVAL;
        while ((line = gbfgetstr(file_in))) {
index f726fdeedd6a9dd87893b5de7757da14fc4aabd5..e33793ab967c26d2eccf0457076a2205ad1c997c 100644 (file)
@@ -335,6 +335,7 @@ static void
 compegps_rd_init(const char *fname)
 {
        fin = gbfopen(fname, "rb", MYNAME);
+       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        input_datum = DATUM_WGS84;
 }
 
diff --git a/cst.c b/cst.c
index 34f9b44d4bc0ee3a9e5765b6c12df8ff1cd336a0..e22d43cc603641d6fbd12946a7fdb4535810378e 100644 (file)
--- a/cst.c
+++ b/cst.c
@@ -139,6 +139,7 @@ static void
 cst_rd_init(const char *fname)
 {
        fin = gbfopen(fname, "rb", MYNAME);
+       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        temp_route = NULL;
 }
 
index 2aca83e66f9b0a5f3a5a507e1fdb897ea09b8ed8..acf7cebe1d7d0c8f5838f216aaf47b16aafa8c1f 100644 (file)
--- a/g7towin.c
+++ b/g7towin.c
@@ -361,6 +361,7 @@ static void
 rd_init(const char *fname)
 {
        fin = gbfopen(fname, "rb", MYNAME);
+       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        
        gardown = 1;
        mode = wptdata;
diff --git a/gopal.c b/gopal.c
index 0767227e3b38824e4deac4a40a8bf1fa7218be03..89175e265c5c39bb6823a13c540de5dded1b54f5 100644 (file)
--- a/gopal.c
+++ b/gopal.c
@@ -126,6 +126,8 @@ gopal_rd_init(const char *fname)
        if (global_opts.debug_level > 1) fprintf(stderr,"setting minspeed to %5.1lf km/h and maxspeed to %5.1lf km/h\n",minspeed,maxspeed);
 
        fin = gbfopen(fname, "r", MYNAME);
+       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
+
        memset(buff,0,sizeof(buff));
        if (optdate)
        {  
index d9f7dcbe3e52a4ec515cc9b7cadb8584c0f9ff8f..ccd59c1631ab94c8f86ccab41b85152c34021664 100644 (file)
--- a/gpsutil.c
+++ b/gpsutil.c
@@ -30,6 +30,7 @@ static void
 rd_init(const char *fname)
 {
        file_in = gbfopen(fname, "rb", MYNAME);
+       if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static void
diff --git a/igc.c b/igc.c
index 94d50d0d75b56caaa39cb6c52e53d093894ac1bd..64738509cf85c63cb3cb4cc41f2a457f7e847601 100644 (file)
--- a/igc.c
+++ b/igc.c
@@ -112,6 +112,7 @@ static void rd_init(const char *fname)
     char *ibuf;
 
     file_in = gbfopen(fname, "r", MYNAME);
+    if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 
     // File must begin with a manufacturer/ID record
     if (get_record(&ibuf) != rec_manuf_id || sscanf(ibuf, "A%3[A-Z]", manufacturer) != 1) {
diff --git a/main.c b/main.c
index 6b0a2d99e7a8b8932530788425796b2253757fad..9109e67f719ef6cafc221ade54385f5d4c1070fd 100644 (file)
--- a/main.c
+++ b/main.c
@@ -84,6 +84,7 @@ load_args(const char *filename, int *argc, char **argv[])
        char **argv2;
        
        fin = gbfopen(filename, "r", "main");
+       (void) gbfunicode(fin); /* check for unicode text file */
        while ((str = gbfgetstr(fin))) {
                str = lrtrim(str);
                if ((*str == '\0') || (*str == '#')) continue;
index 1667e5154d7dec7023f22fc01d2d21b9f738b321..f92d461ce8ecf4d9a53fe1c10e3dca23e7b1bc71 100644 (file)
@@ -55,6 +55,7 @@ static void
 rd_init(const char *fname)
 {
        file_in = gbfopen(fname, "rb", MYNAME);
+       if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
        macstumbler = 0;
 }
 
diff --git a/nmea.c b/nmea.c
index 1f69556275acfbb521bc3503f2ca39151bfa6c53..6c28121dd31a7412a5b095e2a84158fe11d6fb56 100644 (file)
--- a/nmea.c
+++ b/nmea.c
@@ -287,6 +287,7 @@ nmea_rd_init(const char *fname)
 
        read_mode = rm_file;
        file_in = gbfopen(fname, "rb", MYNAME);
+       if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static  void
diff --git a/nmn4.c b/nmn4.c
index d61d272e2d27ea9990ffce4f4ffaa185993f54fc..470c932baebb3ff20b0f70b4dbf69873735d5265 100644 (file)
--- a/nmn4.c
+++ b/nmn4.c
@@ -273,6 +273,7 @@ static void
 nmn4_rd_init(const char *fname)
 {
        fin = gbfopen(fname, "rb", MYNAME);
+       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static void
index b0da23e9e77e5a0b3df0f894399dbcdd5369f5f7..3c96f40a103ae521486b95cb3edc3dc1e6e2fd96 100644 (file)
--- a/overlay.c
+++ b/overlay.c
@@ -153,6 +153,7 @@ static
 void ovl_rd_init(char const *fname)
 {
   fpin = gbfopen(fname, "r", MYNAME);
+       if (gbfunicode(fpin)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 #define SECTION_NONE    0
diff --git a/ozi.c b/ozi.c
index fafa5bd25a5812877637d6971d54e7f636e77fe0..cb953f43ff7858e6012fdc1d0287c057e110b2e3 100644 (file)
--- a/ozi.c
+++ b/ozi.c
@@ -394,6 +394,7 @@ static void
 rd_init(const char *fname)
 {
     file_in = gbfopen(fname, "rb", MYNAME);
+    if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 
     mkshort_handle = mkshort_new_handle();
     ozi_init_units(0);
diff --git a/pcx.c b/pcx.c
index d447ec76f885990c27897c610cbbdf5f6eb673de..37ced9f210f5c0ec98fd3c66074020921e62ba92 100644 (file)
--- a/pcx.c
+++ b/pcx.c
@@ -54,6 +54,7 @@ static void
 rd_init(const char *fname)
 {
        file_in = gbfopen(fname, "rb", MYNAME);
+       if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static void
index 5f2abce188ad53ddf8321b08105c2bcb73305150..5a3d3a2eb1f1d7d48032727d4b04b28c4f2c5af3 100644 (file)
--- a/polygon.c
+++ b/polygon.c
@@ -259,6 +259,7 @@ polygon_process(void)
        gbfile *file_in;
 
        file_in = gbfopen(polyfileopt, "r", MYNAME);
+       (void) gbfunicode(file_in);     /* check for unicode text file */
        
         olat = olon = lat1 = lon1 = lat2 = lon2 = BADVAL;
        while ((line = gbfgetstr(file_in))) {
index ba82e8789b538bde2a6df52fab65a3a9874d087f..3c0f7ebb98831b92c30948367dc32c6fb607773c 100644 (file)
--- a/stmsdf.c
+++ b/stmsdf.c
@@ -336,6 +336,7 @@ static void
 rd_init(const char *fname)
 {
        fin = gbfopen(fname, "r", MYNAME);
+       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        
        lineno = 0;
        route = NULL;
index a2f3081ede43dd993c38022baabdec107b5dd69a..762fe21ce5081abdb9b2896ab382c70ef4fbd2fb 100644 (file)
--- a/stmwpp.c
+++ b/stmwpp.c
@@ -61,6 +61,7 @@ static void
 stmwpp_rd_init(const char *fname)
 {
        fin = gbfopen(fname, "rb", MYNAME);
+       if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1);
        track = NULL;
        route = NULL;
        wpt = NULL;
diff --git a/tiger.c b/tiger.c
index 4b0ae83853d0d5b5985ef7004f46197868962126..f8f4b20406590417b79e793f51fb5cbeb15bef16 100644 (file)
--- a/tiger.c
+++ b/tiger.c
@@ -99,6 +99,7 @@ static void
 rd_init(const char *fname)
 {
        file_in = gbfopen(fname, "rb", MYNAME);
+       if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
        mkshort_handle = mkshort_new_handle();
 }
 
diff --git a/tmpro.c b/tmpro.c
index ee632250e34624665f72af3211a84f4a15b6bead..8028123ac854dbf32c8e988f187c510f9ba53938 100644 (file)
--- a/tmpro.c
+++ b/tmpro.c
@@ -45,6 +45,7 @@ static void
 rd_init(const char *fname)
 {
     file_in = gbfopen(fname, "rb", MYNAME);
+    if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1);
 }
 
 static void